<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>LAMP安装 Discuz！ | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>LAMP安装 Discuz！</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/Apache/">Apache</a> <a class="article__tag-link" href="/tags/LAMP/">LAMP</a>
			</span>
		
	</div>

	

	
		<h2 id="1-官方网站下载discuz！"><a href="#1-官方网站下载discuz！" class="headerlink" title="1.官方网站下载discuz！"></a>1.<a href="http://www.comsenz.com/index.php" target="_blank" rel="external">官方网站</a>下载discuz！</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@lamp ~]<span class="comment"># mkdir /data/www</span></div><div class="line">[root@lamp ~]<span class="comment"># cd /data/www</span></div><div class="line">[root@lamp www]<span class="comment"># wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip</span></div><div class="line">[root@lamp www]<span class="comment"># unzip Discuz_X3.2_SC_GBK.zip</span></div><div class="line">[root@lamp www]<span class="comment"># mv upload/* .</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;删掉其他文件和压缩包</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@lamp www]<span class="comment"># rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip</span></div></pre></td></tr></table></figure>
<h2 id="2-配置第一个虚拟机"><a href="#2-配置第一个虚拟机" class="headerlink" title="2.配置第一个虚拟机"></a>2.配置第一个虚拟机</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;删除 httpd.conf 中的下面这行前面的警号 #</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="comment">#Include conf/extra/httpd-vhosts.conf</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;然后编辑该配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@lamp www]<span class="comment"># vim /usr/local/apache2/conf/extra/httpd-vhosts.conf</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在最后面，加入如下配置：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&lt;VirtualHost *:80&gt;</div><div class="line"> DocumentRoot <span class="string">"/data/www"</span></div><div class="line"> ServerName www.test.com</div><div class="line"> ServerAlias www.aaa.com</div><div class="line">&lt;/VirtualHost&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;先检查配置是否正确</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@lamp www]<span class="comment"># /usr/local/apache2/bin/apachectl -t</span></div><div class="line">Syntax OK</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;重启 apache 服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@lamp www]<span class="comment"># /usr/local/apache2/bin/apachectl restart</span></div></pre></td></tr></table></figure>
<h2 id="3-配置-mysql-，给-Discuz！-增加一个账户"><a href="#3-配置-mysql-，给-Discuz！-增加一个账户" class="headerlink" title="3.配置 mysql ，给 Discuz！ 增加一个账户"></a>3.配置 mysql ，给 Discuz！ 增加一个账户</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;给 mysql root 账户设置密码，谈后命令行进入 mysql ，创建新的库，并创建一个新的帐号对该库有所有权限：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">[root@lamp www]<span class="comment"># /usr/local/mysql/bin/mysql -uroot</span></div><div class="line">    </div><div class="line"></div><div class="line">mysql&gt; create database discuz;</div><div class="line">Query OK, 1 row affected (0.02 sec)</div><div class="line"> </div><div class="line">mysql&gt; grant all on discuz.* to <span class="string">'yanyi'</span>@<span class="string">'localhost'</span> identified by <span class="string">'123456'</span>;</div><div class="line">Query OK, 0 rows affected (0.00 sec)</div><div class="line"> </div><div class="line">mysql&gt; quit</div><div class="line">Bye</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这样就创建了一个库 discuz ，然后有创建了一个用户 yanyi ，密码是 123456.</p>
<h2 id="4-安装-Discuz！"><a href="#4-安装-Discuz！" class="headerlink" title="4.安装 Discuz！"></a>4.安装 Discuz！</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;因为 www.test.com 这个域名是随便定义了一个，所以是不能直接访问的，需要先绑定 hosts ，其中hosts 在windows 和 linux 上都是存在的，可以把一个域名指向到一个 ip 上。windows 下的 hosts 文件路径是在：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;c:\windows\system32\drivers\etc\hosts 。用记事本打开，然后增加一行，保存：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;192.168.0.99   www.test.com www.aaa.com</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这里的 192.168.0.99 是虚拟机的 ip 。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;浏览器输入： <a href="http://www.test.com/install/" target="_blank" rel="external">http://www.test.com/install/</a> 打开页面</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/LAMP%E5%AE%89%E8%A3%85%20Discuz%EF%BC%81/01.png?raw=true" alt=""></figure></p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/LAMP%E5%AE%89%E8%A3%85%20Discuz%EF%BC%81/02.png?raw=true" alt=""></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;根据提示，修改对应目录的权限</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@lamp ~]<span class="comment"># cd /data/www</span></div><div class="line">[root@lamp www]<span class="comment"># chown -R daemon:daemon data uc_server/data uc_client/data config</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;让这几个目录支持 apache 运行帐号可写， deamon 就是 apache 的运行帐号，在 /usr/local/apache2/conf/httpd.conf 中用 User 和 Group 定义的。</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/LAMP%E5%AE%89%E8%A3%85%20Discuz%EF%BC%81/03.png?raw=true" alt=""></figure></p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/LAMP%E5%AE%89%E8%A3%85%20Discuz%EF%BC%81/04.png?raw=true" alt=""></figure></p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/LAMP%E5%AE%89%E8%A3%85%20Discuz%EF%BC%81/05.png?raw=true" alt=""></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这一步，数据库名，就是第三步创建的新数据库。数据库用户名和密码也是第三步创建的用户和密码。管理员密码一定要记得。点下一步后，就会看到安装数据库的过程，然后到 “discuz 应用中心”的页面，直接点右下角“点此访问”，就安装成功discuz 论坛了。</p>

	

	
		<span class="different-posts"><a href="/2017/10/12/Apache/18. LAMP安装 Discuz！/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
